<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>web存储</title>
  <script src="https://cdn.bootcdn.net/ajax/libs/js-cookie/latest/js.cookie.js"></script>
  <script>
    // 设置
    var cookie = Cookies.set('name', 'this is cookie', { expries: 7 })
    // 移除
    Cookies.remove('name');
    // 获取
    console.log(Cookies.get('name'));

    // 2.会话存储
    sessionStorage.setItem('token', '123456789');
    sessionStorage.setItem('name', 'admin');
    // sessionStorage.removeItem('token')
    sessionStorage.clear();
    console.log(sessionStorage.getItem('token'));

    // 3.本地存储
    localStorage.setItem('username', '小明')
    localStorage.setItem('password', '123321')
    // localStorage.removeItem('username');
    localStorage.clear()
    console.log(localStorage.getItem('username'));

  </script>
</head>

<body>

</body>

</html>